package com.cq.controller;

import com.cq.api.DissApi;
import com.cq.pojo.TbUser;
import com.cq.result.Result;
import com.cq.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private DissApi dissApi;
    @Autowired
    private UserService userService;

    @GetMapping("/findDissByUid")
    public Result findDissByUid(Integer uid) {
        TbUser user = userService.getUserByUid(uid);
        user.setDis(dissApi.findDissByUid(uid));
        return Result.success(user);
    }

    @GetMapping("/query")
    public String query() {
        System.out.println("查询成功");
        System.out.println(userService.order());
        return "查询成功";
    }

    @GetMapping("/pay")
    public String pay() {
        System.out.println("支付成功");
        return "支付成功";
    }

    @GetMapping("/order")
    public String order() {
        System.out.println("订单成功");
        System.out.println(userService.order());
        return "订单成功";
    }
}
